package com.siki.pojo.commonEntity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.siki.pojo.base.BaseUuEntity;
import com.siki.pojo.enumeration.common.EducationClaim;
import com.siki.pojo.enumeration.common.PositionCategory;
import com.siki.pojo.enumeration.common.UserSex;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.apache.ibatis.annotations.Many;

import javax.persistence.*;
import java.time.LocalDate;
import java.util.List;

/**
 * 个人用户实体
 *
 * @Author Siki
 * @Date 2020/6/8
 */


@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel("个人用户实体")
@Entity
@Table(name = "general_user")
@TableName(value = "general_user",resultMap = "com.siki.mapper.CommonMap.generalResult")
public class GeneralUser extends BaseUuEntity {
    @ApiModelProperty(value = "性别")
    @Enumerated(EnumType.STRING)
    private UserSex userSex;

    @ApiModelProperty(value = "[个人：居住地]")
    private String address;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "年龄")
    private Integer age;

    @ApiModelProperty(value = "头像url")
    private String avatarUrl;

    /**
     * 简历信息
     */
    @ApiModelProperty(value = "毕业院校")
    private String graduatedSchool;

    @ApiModelProperty(value = "毕业时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDate graduatedDate;

    @ApiModelProperty(value = "所学专业")
    private String profession;

    @ApiModelProperty(value = "学历")
    @Enumerated(EnumType.STRING)
    private EducationClaim education;

    @ApiModelProperty(value = "职业意向类别")
    @Enumerated(EnumType.STRING)
    private PositionCategory intention;

    @ApiModelProperty(value = "预期工资")
    private String expectedSalary;

    @ApiModelProperty(value = "预期工作地点")
    private String expectedCity;

    @ApiModelProperty(value = "自我介绍")
    private String selfIntroduction;

    @ApiModelProperty("是否被禁止:true[是]false[否]")
    @TableField(fill = FieldFill.INSERT)
    private Boolean forbid;

    @ApiModelProperty("user")
    @TableField(exist = false)
    @OneToOne
    private SysUser sysUser;

    @ApiModelProperty("投诉的岗位")
    @ManyToMany
    @JoinTable(name="general_user_talent_position", joinColumns={@JoinColumn(name="gu_id")}, inverseJoinColumns={@JoinColumn(name="tp_id")})
    @TableField(exist = false)
    private List<TalentPosition> complaintTalentPositions;

    @ManyToMany
    @ApiModelProperty("应聘的岗位")
    @JoinTable(name = "apply_general_position", joinColumns={@JoinColumn(name="gu_id")}, inverseJoinColumns={@JoinColumn(name="tp_id")} )
    @TableField(exist = false)
    List<TalentPosition> applyTalentPositions;

    @ManyToOne
    @ApiModelProperty("被拉黑的企业")
    @TableField(exist = false)
    Enterprise blackEnterprise;
}
